import type { App } from 'vue'
import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'

import index from '../views/fb/index.vue'
import Release from '../views/fb/zzy/Release.vue'
import Zhengtao from '../views/fb/zzy/Zhengtao.vue'
import Danjian from '../views/fb/zzy/Danjian.vue'
import CitySelect from '../views/fb/zzy/CitySelect.vue'


const routes: RouteRecordRaw[] = [
    {
        path: '/',
        redirect: '/startpage'
    },
    {
        path: '/login',
        component: () => import('../views/login/index.vue')
    },
    {
        path: '/startpage',
        component: () => import('../views/StartPage.vue')
    },
    {
        path: '/register',
        component: () => import('../views/register/index.vue')
    },
    {
        path: '/forgetpassword',
        component: () => import('../views/forgetpassword/index.vue')
    },
    {
        path: '/telyz',
        component: () => import('../views/mine/telyz.vue')
    },
    {
        path: '/taber',
        component: () => import('../components/Tabbar.vue'),
        children: [
            {
                path: 'home',
                component: () => import('../views/home/index.vue')
            },
            {
                path: 'zhou',
                component: () => import('../views/home/zhou.vue')
            },
            {
                path: 'mine',
                component: () => import('../views/mine/index.vue')
            },
            {
                path: 'nomessage',
                component: () => import('../views/mine/nomessage.vue')
            },
            {
                path: 'shoucang',
                component: () => import('../views/mine/shoucang.vue')
            },
            {
                path: 'myhouse',
                component: () => import('../views/mine/myhouse.vue')
            },
            {
                path: 'test',
                component: () => import('../views/test/index.vue')
            },
            {
                path: 'map',
                component: () => import('../views/gy/Map/Map.vue')
            },
            {
                path: 'message',
                component: () => import('../views/message/message.vue')
            },
            {
                path: 'release',
                component: () => import('../views/fb/zzy/Release.vue')
            },
        ]
    },
    {
        path: '/yiyue',
        component: () => import('../views/home/yiyue.vue')
    },
    {
        path: '/yuyue',
        component: () => import('../views/home/yuyue.vue')
    },
    {
        path: '/fangd',
        component: () => import('../views/home/fangd.vue')
    },
    {
        path: '/commuter',
        component: () => import('../views/gy/Commuter/Commuter.vue')
    },
    {
        path: '/zheng',
        component: () => import('../views/home/zheng.vue')
    },
    {
        path: '/sou',
        component: () => import('../views/home/sou.vue')
    },
    {
        path: '/xiang',
        component: () => import('../views/home/xiang.vue')
    },
    {
        path: '/changephone',
        component: () => import('../views/mine/changephone.vue')
    },
    {
        path: '/safe',
        component: () => import('../views/mine/Safe.vue')
    },
    {
        path: '/myself',
        component: () => import('../views/mine/myself.vue')
    },
    {
        path: '/setting',
        component: () => import('../views/mine/Setting.vue')
    },
    {
        path: '/talking',
        component: () => import('../views/message/Talking.vue')
    }, {
        path: '/ai',
        component: () => import('../views/message/Ai.vue')
    }, {
        path: '/three',
        component: () => import('../views/three/App.vue')
    },

    // {
    //     path: '/index',
    //     component: index
    // },
    {
        path: '/cityelect',
        name: 'cityelect',
        component: () => import('../views/fb/zzy/CitySelect.vue')
    },
    {
        path: '/danjian',
        name: 'danjian',
        component: () => import('../views/fb/zzy/Danjian.vue')
    },
    {
        path: '/zhengtao',
        name: 'zhengtao',
        component: () => import('../views/fb/zzy/Zhengtao.vue')
    },

]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export const useRouter = (app: App) => {
    app.use(router)
}